#ifndef __THREAD_POOL_H__
#define __THREAD_POOL_H__

#include "Thread.h"
#include "TaskQueue.h"
#include <vector>
#include <memory>

using std::vector;
using std::unique_ptr;

namespace myNameSpace {
class ThreadPool {
public:
    ThreadPool(size_t threadsNum, size_t queueSize);
    ~ThreadPool();

    void start();
    void addTask(TaskQueue::ElemType &&taskCallback);
    void stop();

private:
    void doTask();

private:
    vector<unique_ptr<Thread>> _threads;
    size_t _threadsNum;
    TaskQueue _taskQueue;
    bool _isExit;
};
} // end of namespace myNameSpace

#endif

